package net.sample.gismeteo;

/**
 * Represents one item of weather forecast.
 * @author vkozlov
 * @version $Id: $
 */
public class WeatherInfo {
	private int day;
	private int month;
	private int year;
	private int hour;
	private int tod;
	private int weekday;
	private int cloudiness;
	private int precipitation;
	private String pressureMin;
	private String pressureMax;
	private String temperatureMin;
	private String temperatureMax;
	private String windMin;
	private String windMax;
	private int windDir;
	private String relwetMin;
	private String relwetMax;
	
	/**
	 * @return the day
	 */
	public int getDay() {
		return day;
	}
	/**
	 * @param day the day to set
	 */
	public void setDay(int day) {
		this.day = day;
	}
	/**
	 * @return the month
	 */
	public int getMonth() {
		return month;
	}
	/**
	 * @param month the month to set
	 */
	public void setMonth(int month) {
		this.month = month;
	}
	/**
	 * @return the year
	 */
	public int getYear() {
		return year;
	}
	/**
	 * @param year the year to set
	 */
	public void setYear(int year) {
		this.year = year;
	}
	/**
	 * @return the hour
	 */
	public int getHour() {
		return hour;
	}
	/**
	 * @param hour the hour to set
	 */
	public void setHour(int hour) {
		this.hour = hour;
	}
	/**
	 * @return the tod
	 */
	public int getTod() {
		return tod;
	}
	/**
	 * @param tod the tod to set
	 */
	public void setTod(int tod) {
		this.tod = tod;
	}
	/**
	 * @return the weekday
	 */
	public int getWeekday() {
		return weekday;
	}
	/**
	 * @param weekday the weekday to set
	 */
	public void setWeekday(int weekday) {
		this.weekday = weekday;
	}
	/**
	 * @return the cloudiness
	 */
	public int getCloudiness() {
		return cloudiness;
	}
	/**
	 * @param cloudiness the cloudiness to set
	 */
	public void setCloudiness(int cloudiness) {
		this.cloudiness = cloudiness;
	}
	/**
	 * @return the precipitation
	 */
	public int getPrecipitation() {
		return precipitation;
	}
	/**
	 * @param precipitation the precipitation to set
	 */
	public void setPrecipitation(int precipitation) {
		this.precipitation = precipitation;
	}
	/**
	 * @return the pressureMin
	 */
	public String getPressureMin() {
		return pressureMin;
	}
	/**
	 * @param pressureMin the pressureMin to set
	 */
	public void setPressureMin(String pressureMin) {
		this.pressureMin = pressureMin;
	}
	/**
	 * @return the pressureMax
	 */
	public String getPressureMax() {
		return pressureMax;
	}
	/**
	 * @param pressureMax the pressureMax to set
	 */
	public void setPressureMax(String pressureMax) {
		this.pressureMax = pressureMax;
	}
	/**
	 * @return the temperatureMin
	 */
	public String getTemperatureMin() {
		return temperatureMin;
	}
	/**
	 * @param temperatureMin the temperatureMin to set
	 */
	public void setTemperatureMin(String temperatureMin) {
		this.temperatureMin = temperatureMin;
	}
	/**
	 * @return the temperatureMax
	 */
	public String getTemperatureMax() {
		return temperatureMax;
	}
	/**
	 * @param temperatureMax the temperatureMax to set
	 */
	public void setTemperatureMax(String temperatureMax) {
		this.temperatureMax = temperatureMax;
	}
	/**
	 * @return the windMin
	 */
	public String getWindMin() {
		return windMin;
	}
	/**
	 * @param windMin the windMin to set
	 */
	public void setWindMin(String windMin) {
		this.windMin = windMin;
	}
	/**
	 * @return the windMax
	 */
	public String getWindMax() {
		return windMax;
	}
	/**
	 * @param windMax the windMax to set
	 */
	public void setWindMax(String windMax) {
		this.windMax = windMax;
	}
	/**
	 * @return the windDir
	 */
	public int getWindDir() {
		return windDir;
	}
	/**
	 * @param windDir the windDir to set
	 */
	public void setWindDir(int windDir) {
		this.windDir = windDir;
	}
	/**
	 * @return the relwetMin
	 */
	public String getRelwetMin() {
		return relwetMin;
	}
	/**
	 * @param relwetMin the relwetMin to set
	 */
	public void setRelwetMin(String relwetMin) {
		this.relwetMin = relwetMin;
	}
	/**
	 * @return the relwetMax
	 */
	public String getRelwetMax() {
		return relwetMax;
	}
	/**
	 * @param relwetMax the relwetMax to set
	 */
	public void setRelwetMax(String relwetMax) {
		this.relwetMax = relwetMax;
	}

	public String toString() {
		StringBuffer buffer = new StringBuffer();
		buffer.append("WeatherInfo[");
		buffer.append("cloudiness=").append(cloudiness);
		buffer.append(";day=").append(day);
		buffer.append(";hour=").append(hour);
		buffer.append(";month=").append(month);
		buffer.append(";precipitation=").append(precipitation);
		buffer.append(";pressureMax=").append(pressureMax);
		buffer.append(";pressureMin=").append(pressureMin);
		buffer.append(";relwetMax=").append(relwetMax);
		buffer.append(";relwetMin=").append(relwetMin);
		buffer.append(";temperatureMax=").append(temperatureMax);
		buffer.append(";temperatureMin=").append(temperatureMin);
		buffer.append(";tod=").append(tod);
		buffer.append(";weekday=").append(weekday);
		buffer.append(";windDir=").append(windDir);
		buffer.append(";windMax=").append(windMax);
		buffer.append(";windMin=").append(windMin);
		buffer.append(";year=").append(year);
		buffer.append("]");
		return buffer.toString();
	}
	
	public String getWeatherImageResourceName() {
		String nd = (new String[]{"n_", "d_", "d_", "n_"})[getTod()];
		String cl = (new String[]{"0cloud", "1cloud_", "2cloud_", "3cloud_"})[getCloudiness()];
		String pr = ""; 
		if (getCloudiness() > 0) {
			pr = (new String[]{"", "", "", "", "modrain", "heavyrain", "snow", "snow", 
					"thunders", "norain", "norain"})[getPrecipitation()];
		}
		String resultId = nd + cl + pr;
		return resultId;
	}
	
}
